import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    component: () => import(/* webpackChunkName: "MyIndex" */ '../views/MyIndex'),
    children: [
      { path: '/', component: () => import(/* webpackChunkName: "MyHom" */ '../views/MyHom/MyHom.vue') },
      { path: '/FenLei/:id', component: () => import(/* webpackChunkName: "MyFenlei" */ '../views/fenlei-category/MyFenlei.vue') },
      { path: '/FenLei/ErjiZhanshi/:id', component: () => import(/* webpackChunkName: "ErjiZhanshi" */ '../views/fenlei-category/components/erjizhanshi-bread.vue') },
      { path: '/Tuijian/:id', component: () => import(/* webpackChunkName: "Tuijian" */ '../views/xianqing-goods/My-goods.vue') }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes,
  // 每次切换路由的时候滚动到顶部
  scrollBehavior () {
    return { left: 0, top: 0 }
  }
})

export default router
